{include file="header"}
<div style="padding: 20px;">
<div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
  <ul class="layui-tab-title">
    <a href="/admin.php/addons/index.html"><li class="layui-this">本地插件</li></a>
    <a href="/admin.php/addons/zaixian.html"><li>在线插件</li></a>
  </ul>
  <div class="layui-tab-content"></div>
</div>   
{if condition="$list eq 0"}
<blockquote style="padding: 10px;border-left: 5px solid #009688;" class="layui-elem-quote">还未有任何插件</blockquote>
{else /}
<div style="overflow: auto;">
<table class="layui-table adminmyucms" lay-size="lg">
  <colgroup>
    <col width="150">
    <col width="200">
    <col>
  </colgroup>
  <thead>
    <tr>
      <th>图标</th>
      <th>插件名</th>
      <th>版本</th>
      <th>描述</th>
      <th>作者</th>
      <th>操作</th>
    </tr> 
  </thead>
  <tbody>
  	{foreach name="list" item="vo"}
    <tr>
      <td><div align="center"> <img src="{$vo.pic}" alt="{$vo.title}" width="60" height="60"></div>  </td>
      <td>{$vo.title}</td>
      <td>V{$vo.version}</td>
      <td>{$vo.description}</td>
      <td><a target="_blank" href="{$vo.url|default='http://www.115cms.com'}">{$vo.author}</a></td>
      <td id="admin_set">
      {eq name="vo.uninstall" value="0"}
      <!--安装后--> 
      {if condition="$vo['has_adminlist'] eq '1'"}
      <!--有后台-->  
      <a  data-method="admin_set" member-id="{$vo.id}" url="/admin.php/addons/admin/name/{$vo.name}.html" class="layui-btn layui-btn-warm">  <span class="button-content"> 管理</span></a>
      {/if}
      {if condition="$vo['config'] neq 'null'"}
      <!--设置-->
      <a  data-method="admin_set" member-id="{$vo.id}" url="{:url('addons/config',array('id'=>$vo['id']))}" class="layui-btn layui-btn-normal">  <span class="button-content">设置</span></a> 
      {/if}
      <a class="layui-btn layui-btn-danger xiezai" href="javascript:;" data-adminlist="{$vo['has_adminlist']}" data-uurl="{:url('addons/adminlist',array('name'=>$vo['name']))}" data-url="{:url('addons/uninstall',array('id'=>$vo['id']))}" zs-name="{$vo['name']}"  >  <span class="button-content"> 卸载</span></a>
					 
		{else /} 
		<!--安装后-->  
		<a class="layui-btn layui-btn-normal  anzhuang" href="javascript:;" data-adminlist="{$vo['has_adminlist']}" data-uurl="{:url('addons/adminlist',array('name'=>$vo['name']))}" data-url="{:url('addons/install',array('addonname'=>$vo['name']))}" > 
                   <span class="button-content"> 安装</span> 
           </a> 
        <a class="layui-btn layui-btn-danger shanchu"  lay-submit="" nickname="{$vo.name}"lay-submit lay-filter="un"><span class="button-content"> 删除</span></a>
      {/eq}
      </td>
    </tr>
    {/foreach}
  </tbody>
</table>
</div>    
{/if}
<script>
layui.use('form',function(){
  var form = layui.form
  ,jq = layui.jquery;
  //删除
  form.on('submit(un)', function(data){
  	layer.confirm('确定要删除吗？删除后只能重新下载', function(data) {
    loading = layer.load(2, {
      shade: [0.2,'#000']
    });
    var name = $(".shanchu").attr('nickname');
    var param = data.field;
    jq.post('/admin.php/addons/un.html?info='+name+'',param,function(data){
      if(data.code == 1){
        layer.close(loading);
        layer.msg(data.msg, {icon: 1, time: 1000}, function(){
          location.reload();
        });
      }else{
        layer.close(loading);
        layer.msg(data.msg, {icon: 2, anim: 6, time: 1000});
      }
    });
  	});
    return false;
  });
  jq('.anzhuang').click(function(){
  	var url=jq(this).data('url');
    var ids = jq(this).attr('ids');
      loading = layer.load(2, {
        shade: [0.2,'#000']
      });
      jq.getJSON(url,function(data){
        if(data.code == 1){
          layer.close(loading);
          layer.msg(data.msg, {icon: 1, time: 1000}, function(){
            location.reload();
          });
        }else{
          layer.close(loading);
          layer.msg(data.msg, {icon: 2, anim: 6, time: 1000});
        }
      });
  });
  
  jq('.xiezai').click(function(){
  	var url=jq(this).data('url');
    var ids = jq(this).attr('ids');
      loading = layer.load(2, {
        shade: [0.2,'#000']
      });
      jq.getJSON(url,function(data){
        if(data.code == 1){
          layer.close(loading);
          layer.msg(data.msg, {icon: 1, time: 1000}, function(){
            location.reload();
          });
        }else{
          layer.close(loading);
          layer.msg(data.msg, {icon: 2, anim: 6, time: 1000});
        }
      });
  });
});
</script>
</div>  
{include file="footer"}